Page({
  data: {
    isLogin: false
  },
  onLoad() {
    wx.getSetting({
      success: (res) => {
        let isAuthor = res.authSetting['scope.userInfo'];
        this.setData({
          isLogin: isAuthor
        })
        if (isAuthor) {
          wx.getUserInfo({
            lang: 'zh_CN',
            success: (res) => {
              this.setData({
                userInfo: res.userInfo
              });
            }
          })
        }
      }
    })
  },
  onStart() {
    wx.switchTab({
      url: '../news/news',
    })
  },
  goAuthor() {
    wx.navigateTo({
      url: '../author/author',
    })
  }
})